/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.Util.Reportclass;

import java.util.ArrayList;
import java.util.List;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;

/**
 *
 * @author oscar
 */
public class SimuaeroDataSource implements JRDataSource{
    private List<Simuaero> lstSimuaero = new ArrayList<>();
    private int ind = -1;
    
    public void addSimuaero(Simuaero lg) { lstSimuaero.add(lg); }

    @Override
    public boolean next() throws JRException {
        return ++ind < lstSimuaero.size();
    }

    @Override
    public Object getFieldValue(JRField jrf) throws JRException {
        Object valor = null;
        switch (jrf.getName()) {
            case "Aeropuerto":
                valor = lstSimuaero.get(ind).getDescripcion();
                break;
            case "Capacidada":
                valor = lstSimuaero.get(ind).getCapactual();
                break;
            case "Saturaciona":
                valor = lstSimuaero.get(ind).getSatactual();
                break;
            case "Capacidads":
                valor = lstSimuaero.get(ind).getCapfutura();
                break;
            case "Saturacions":
                valor = lstSimuaero.get(ind).getSatfutura();
                break;                                                               
        }
        return valor;
    }
    
}
